﻿using System.Windows;
using System.Windows.Controls;

namespace Waaahsabi.Controls.TheGame
{
	public class GenericWelcomeScreen : Control
	{
		#region WelcomeTitle DependencyProperty
		public static readonly DependencyProperty WelcomeTitleProperty =
		DependencyProperty.Register
			(
			"WelcomeTitle",
			typeof(string),
			typeof(GenericWelcomeScreen),
			new PropertyMetadata("Dummy System (Dummy Corp.)")
			);

		public string WelcomeTitle
		{
			get { return (string)GetValue(WelcomeTitleProperty); }
			set { SetValue(WelcomeTitleProperty, value); }
		}
		#endregion

		#region WelcomeMessage DependencyProperty
		public static readonly DependencyProperty WelcomeMessageProperty =
		DependencyProperty.Register
			(
			"WelcomeMessage",
			typeof(string),
			typeof(GenericWelcomeScreen),
			new PropertyMetadata("Welcome to this dummy system. This text has obviously not been filled correctly. Please tell tech support about this. Thank you.")
			);

		public string WelcomeMessage
		{
			get { return (string)GetValue(WelcomeMessageProperty); }
			set { SetValue(WelcomeMessageProperty, value); }
		}
		#endregion.

		public event RoutedEventHandler ContinueClicked;
		public event RoutedEventHandler DisconnectClicked;

		private Button _btnContinue;
		private Button _btnDisconnect;

		public GenericWelcomeScreen()
		{
			DefaultStyleKey = typeof(GenericWelcomeScreen);
		}

		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();
			_btnContinue = GetTemplateChild("btnContinue") as Button;
			if (_btnContinue != null)
				_btnContinue.Click += ContinueClicked;
			_btnDisconnect = GetTemplateChild("btnDisconnect") as Button;
			if (_btnDisconnect != null)
				_btnDisconnect.Click += DisconnectClicked;
		}
	}
}
